package controller.wechat;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import util.api.ApIURL;
import util.httpclient.HttpService;

import java.io.IOException;
import java.net.URISyntaxException;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by thinkjoy on 2017/8/30.
 * 获取ip
 */
@Controller
@RequestMapping("/ws/all/")
public class WeChatIP {

    @Autowired
    private HttpService httpService;

    @RequestMapping("ip")
    @ResponseBody
    public String getIP(){
        Map<String,Object> value=new HashMap<>();
        value.put("access_token", ApIURL.ACCESS_TOKEN);
        try {
            String result=httpService.doGet(ApIURL.IP_URL,value);
            return result;
        } catch (URISyntaxException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }
}
